To move the Primer II code up to THINK 5 or THINK 6, read this errata sheet. To move it up to THINK 7+, you should also read the errata sheet entitled "Primer, THINK 6->THINK 7.w", which will take you through the changes to Primer, Vol I. You'll need to make the same basic changes here. Unfortunately, getting the starter code to run under TCL 2.0 is too major a change. I'd just read chapter 6 and ignore the code, then read "Learn C++ on the Macintosh" to get started with C++. By the way, I've included a few of my MacTech columns that deal with rewrites of Primer II code...
Dave
-----------------
cdev.c:
1) Insert line, just after #defines:
short FindFontNumber();
Tester.c:
1) Replace #define MOVE_TO_FRONT from
-1L
to
(WindowPtr)-1L
2) Change BeginUpdate( gTheEvent.message ) to
BeginUpdate( (WindowPtr)gTheEvent.message )
3) Change EndUpdate( gTheEvent.message ) to
EndUpdate( (WindowPtr)gTheEvent.message )
DLOG.c:
1) Replace #define MOVE_TO_FRONT from
-1L
to
(WindowPtr)-1L
ColorInfo.c:
1) Replace the line:
#include "ColorToolbox.h"
with
#include "Picker.h"
Palette.c:
1) Replace the line:
#include "ColorToolbox.h"
with the two lines:
#include "Palettes.h"
#include "Picker.h"
2) Replace #define MOVE_TO_FRONT from
-1L
to
(WindowPtr)-1L
ColorTutor.c:
1) Replace the line:
#include "ColorToolbox.h"
with the two lines:
#include "Palettes.h"
#include "Picker.h"
2) Replace #define MOVE_TO_FRONT from
-1L
to
(WindowPtr)-1L
GWorld.c:
1) Replace the two lines:
#include "ColorToolbox.h"
#include "QuickDraw32Bit.h"
with the two lines:
#include "Picker.h"
#include "QDOffscreen.h"
2) Replace #define MOVE_TO_FRONT from
-1L
to
(WindowPtr)-1L
FormEdit.c:
1) In the function DoTEKey(), replace the line:
tempStr[ i+1 ] = (*text)[ i ];
with the line:
tempStr[ i+1 ] = (*(char **)text)[ i ];
2) In the function HandleEditChoice(), replace the line:
tempStr[ i+1 ] = (*text)[ i ];
with the line:
tempStr[ i+1 ] = (*(char **)text)[ i ];
3) Replace #define MOVE_TO_FRONT from
-1L
to
(WindowPtr)-1L
4) In the function NewClikLoop(), replace the declaration:
int amount;
with the line:
short amount;
Starter.π:
1) Make a copy of the "Starter Folder" found in the "TCL 1.1 Demos" folder in your
"Development" folder. Next, copy the following files from your old "MyStarter"
folder into this new folder:
- CDragPane.c
- CDragPane.h
- CMouse.c
- CMouse.h
- CStarterApp.c
- CStarterApp.h
- CStarterDoc.c
- CStarterApp.h
- CStarterPane.c
- CStarterPane.h
- Starter.c
You should be copying 11 files, replacing their counterparts in the new folder.
Start up THINK C by double-clicking the file Starter.π in this new folder.
2) Select Options... from the Edit menu.
Select "Language Settings" from the popup menu.
Make sure that the "Language Extensions" check box is checked.
Select the "THINK C + Objects" radio button.
Make sure the "Strict Prototype Enforcement" check box is checked.
Select the "Infer Prototypes" radio button.
3) Edit each of the functions in the files CDragPane.c, CMouse.c, and
CStarterPane.c. Change each function's parameter declarations from
the old style to the new style of parameter declaration. Old style
declarations look like this:
void CDragPane::DoClick( hitPt, modifierKeys, when )
Point hitPt;
short modifierKeys;
long when;
{
}
New style declarations look like this:
void CDragPane::DoClick( Point hitPt, short modifierKeys, long when )
{
}
4) In the file CDragPane.c, in the function IDragPane,
change the declaration:
Rect r;
to
LongRect r;
5) Also in CDragPane.c, in the function DoClick, change the first
five lines from:
Rect r;
Rect endLocation;
r = frame;
EraseRect( &r );
FrameToEnclR(&r);
to these eight lines:
Rect r;
Rect endLocation;
LongRect longR;
FrameToQDR( &frame, &r );
EraseRect( &r );
QDToLongRect(&r,&longR);
FrameToEnclR(&longR);
LongToQDRect( &longR, &r );
6) In the file CMouse.h, change the three lines:
void BeginTracking( Point *startPt );
void KeepTracking( Point *currPt, Point *prevPt, Point *startPt );
void EndTracking( Point *currPt, Point *prevPt, Point *startPt );